var Person = (function () {
    function Person(name,age) {
        this._name = name;
        this._age = age;
    }

    Person.prototype.birthday = function () {
        this._age += 1;
    };

    Person.prototype.age = function(newAge) {
        if(newAge){
            this._age = newAge;
            return this;
        }
        else {
            this._age;
        }
    };

    Person.prototype.getAge = function(){
        return this._age;
    };

    Person.prototype.setAge = function(newAge) {
        this._age = newAge;
    };

    return Person;
}());

var Student = (function(){
    function Student(name, age, grade) {
        this._name = name;
        this._age = age;
        this._grade = grade;
    }

    Student.prototype = new Person();
    Student.prototype.constructor = Student; // слага се против проблеми

    return Student;
}());

var st = new Student('Иван', 17, 10);

console.log(st.getAge);
console.log(st instanceof Student); // true
console.log(st instanceof Person); // true

var studenOne = new Student();
for (var prop in studenOne) {
    if (hasOwnProperty(prop)) { // не е коректно, да се провери в интернет
        console.log(prop);
    }
}

